home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / AmiTCP30b2.lha / src / amitcp / kern / amiga_config.h < prev    next >
C/C++ Source or Header  |  1994-01-18  |  5KB  |  153 lines

  1. #ifndef AMIGA_CONFIG_H
  2. #define AMIGA_CONFIG_H
  3. /* $Id: amiga_config.h,v 1.17 1994/01/18 02:27:22 jraja Exp $
  4.  *
  5.  * kern/amiga_config.h --- configuration declarations
  6.  *
  7.  * Author: ppessi <Pekka.Pessi@hut.fi>
  8.  *
  9.  * Copyright (c) 1993 OHT-AmiTCP/IP Group,
  10.  *                    Helsinki University of Technology, Finland.
  11.  *                    All rights reserved.
  12.  *
  13.  * Created      : Thu Apr 22 12:05:05 1993 ppessi
  14.  * Last modified: Mon Dec 20 10:20:26 1993 jraja
  15.  *
  16.  * $Log: amiga_config.h,v $
  17.  * Revision 1.17  1994/01/18  02:27:22  jraja
  18.  * Added SPACE(X) macro.
  19.  *
  20.  * Revision 1.15  1993/12/20  08:24:16  jraja
  21.  * Added new rexx keyword: "KILL" + prototype for the sendbreak() function.
  22.  *
  23.  * Revision 1.14  1993/11/06  23:51:22  ppessi
  24.  * Changed error message format.
  25.  *
  26.  * Revision 1.13  1993/06/03  16:39:39  jraja
  27.  * Added VAR_ENUM variable type.
  28.  *
  29.  * Revision 1.12  1993/05/31  23:31:05  jraja
  30.  * C=CONNECTIONS keyword deleted, getsockets() prototype deleted.
  31.  *
  32.  * Revision 1.11  1993/05/29  20:51:15  jraja
  33.  * Removed config file path, added error value ERR_NOWRITE,
  34.  * Changed readconfig to return BOOL.
  35.  *
  36.  * Revision 1.10  1993/05/17  01:02:04  ppessi
  37.  * Changed RCS version
  38.  *
  39.  * Revision 1.9  1993/05/16  00:12:11  jraja
  40.  * Minor cosmetic changes.
  41.  *
  42.  * Revision 1.8  1993/05/15  20:14:08  jraja
  43.  * Added RESET to the rexx keywords template, also changed order to agree with
  44.  * enum keyword.
  45.  *
  46.  * Revision 1.7  93/05/14  11:36:39  11:36:39  ppessi (Pekka Pessi)
  47.  * Error messages now global constants.
  48.  * 
  49.  * Revision 1.6  93/05/04  12:20:10  12:20:10  jraja (Jarno Tapio Rajahalme)
  50.  * fix.
  51.  * 
  52.  * Revision 1.5  93/04/28  21:55:03  21:55:03  ppessi (Pekka Pessi)
  53.  * Added some prototypes.
  54.  * 
  55.  * Revision 1.4  93/04/28  13:36:27  13:36:27  too (Tomi Ollila)
  56.  * Fixed one #defien to #define
  57.  * this revision includes also some ppessi work
  58.  * 
  59.  * Revision 1.3  93/04/25  21:00:17  21:00:17  too (Tomi Ollila)
  60.  * Changed some structure field names for consistency
  61.  * 
  62.  * Revision 1.2  93/04/23  21:01:28  21:01:28  puhuri (Markus Peuhkuri)
  63.  * Add prototype for getsockets.
  64.  * 
  65.  * Revision 1.1  93/04/23  00:26:57  00:26:57  ppessi (Pekka Pessi)
  66.  * Initial revision
  67.  * 
  68.  * Revision 1.1  93/04/22  12:26:23  ppessi
  69.  * Initial revision
  70.  *
  71.  */
  72.  
  73. extern BOOL initialized;    /* are we up? */
  74.  
  75. #define CURRENT(X) ((X)->CS_Buffer+(X)->CS_CurChr)
  76. #define SPACE(X)   ((X)->CS_Length-(X)->CS_CurChr)
  77.  
  78. #define KEYWORDLEN 24        /* buffer len for keywords */
  79. #define CONFIGLINELEN 1024    /* buffer len for configuration line */
  80. #define REPLYBUFLEN 255
  81. #define MAXRVALLEN 10
  82.  
  83. /* Parsing error messages */
  84. extern UBYTE ERR_UNKNOWN[];
  85. extern UBYTE ERR_ILLEGAL_VAR[];
  86. extern UBYTE ERR_ILLEGAL_IND[];
  87. extern UBYTE ERR_SYNTAX[];
  88. extern UBYTE ERR_TOO_LONG[];
  89. extern UBYTE ERR_MEMORY[];
  90. extern UBYTE ERR_NONETDB[];
  91. extern UBYTE ERR_VALUE[];
  92. extern UBYTE ERR_NOWRITE[];
  93.  
  94. /* The command keywords and their tokens */
  95. /* Note: ROUTE is currently not implemented */
  96. #define REXXKEYWORDS "Q=QUERY,S=SET,READ,ROUTE,ADD,RESET,KILL"
  97. enum keyword
  98. { KEY_QUERY, KEY_SET, KEY_READ, KEY_ROUTE, KEY_ADD, KEY_RESET, KEY_KILL };
  99.  
  100. /* Variable types */
  101. /* Note: Query calls value, Set calls notify functions */
  102. enum var_type
  103. {
  104.  VAR_FUNC = 1,        /* value is function pointer */
  105.  VAR_LONG,        /* value is pointer to LONG */
  106.  VAR_STRP,        /* value is pointer to string */
  107.  VAR_FLAG,        /* LONG value is set once */
  108.  VAR_INET,        /* struct sockaddr_in */
  109.  VAR_ENUM        /* value is pointer to long, whose value is set
  110.                            according to a enumeration string in notify */
  111. };
  112.  
  113. typedef LONG 
  114.   (*var_f)(struct CSource *args, UBYTE **errstrp, struct CSource *res);
  115. typedef int (*notify_f)(void *pt, LONG new);
  116.  
  117. /* Configurable variable structure */
  118. struct cfg_variable {
  119.   enum var_type type;        /* type of value */
  120.   WORD  flags;            /* see below */
  121.   const UBYTE *index;        /* optional index keyword list */
  122.   void  *value;            /* pointer to value... */
  123.   notify_f notify;        /* notification function */
  124. };
  125.  
  126. #define boolean_enum (notify_f)"NO=FALSE=OFF=0,YES=TRUE=ON=1"
  127.  
  128. /* Variable flags */
  129. #define VF_TABLE    (1<<0) /* with an index... */
  130. #define VF_READ     (1<<1) /* readable */
  131. #define VF_WRITE    (1<<2) /* writeable */
  132. #define VF_CONF     (1<<3) /* writeable only during configuration */
  133. #define VF_RW       (VF_WRITE|VF_READ)
  134. #define VF_RCONF    (VF_CONF|VF_READ)
  135. #define VF_FREE     (1<<8) /* free when replaced? */
  136.  
  137. BOOL readconfig(void);
  138.  
  139. LONG parsefile(UBYTE const *fname, UBYTE **errstrp, struct CSource *res);
  140. LONG parseline(struct CSource *args, UBYTE **errstrp, struct CSource *res);
  141. LONG readfile(struct CSource *args, UBYTE **errstrp, struct CSource *res);
  142. LONG getvalue(struct CSource *args, UBYTE **errstrp, struct CSource *res);
  143. LONG setvalue(struct CSource *args, UBYTE **errstrp, struct CSource *res);
  144. LONG sendbreak(struct CSource *args, UBYTE **errstrp, struct CSource *res);
  145.  
  146. /*LONG read_gets(struct CSource *args, UBYTE **errstrp, struct CSource *res);*/
  147. LONG read_sets(struct CSource *args, UBYTE **errstrp, struct CSource *res);
  148.  
  149. LONG parseroute(struct CSource *args, UBYTE **errstrp, struct CSource *res);
  150.  
  151. #endif /* !AMIGA_CONFIG_H */
  152.  
  153.